import Vue from 'vue'
import VueRouter from 'vue-router'
// 首页
import Home from '@/views/HomePage'
// 首页次级路由
import users from '@/views/Second/user'
// 个人推荐子路路由
import xiyou from '@/views/Second/third/xiyou'
import hong from '@/views/Second/third/hong'
import shui from '@/views/Second/third/shui'
// 推荐首页
import recommend from '@/views/Second/recommend'

// 一级路由
import Order from '@/views/OrderPage'
// 分类次级路由
import comedy from '@/views/Second/comedy'
import terror from '@/views/Second/terror'

import Cate from '@/views/CategoryPage'
import User from '@/views/UserPage'

Vue.use(VueRouter)

const routes = [
  // 默认地址，首页
  {
    path: '/',
    redirect: '/home',
  },
  // 首页
  {
    path: '/home',
    name: 'home',
    component: Home,
    // 首页子级路由
    children: [
      {
        path: 'users',
        name: 'users',
        component: users,
      },
      {
        path: 'recommend',
        name: 'recommend',
        component: recommend,
        children: [
          {
            path: 'xiyou',
            name: 'xiyou',
            component: xiyou,
          },
          {
            path: 'hong',
            name: 'hong',
            component: hong,
          },
          {
            path: 'shui',
            name: 'shui',
            component: shui,
          },
        ],
      },
    ],
  },
  // 分类
  {
    path: '/order',
    name: 'order',
    component: Order,
    // 分类子级路由
    children: [
      {
        path: 'comedy',
        name: 'comedy',
        component: comedy,
      },
      {
        path: 'terror',
        name: 'terror',
        component: terror,
      },
    ],
  },
  // 订单
  {
    path: '/cate',
    name: 'cate',
    component: Cate,
  },
  // 个人中心
  {
    path: '/user',
    name: 'user',
    component: User,
  },
]

const router = new VueRouter({
  routes,
})

export default router
